<template>
    <Header>
        <div class="top">
            <span>后台管理</span>
        </div>
        <div class="user">
            <span>登录用户：{{ username }}</span>
            <a href="javascript:;" @click="logout">退出</a>
        </div>
    </Header>
</template>
<script>
import {Header} from 'view-ui-plus';
export default {
    comments: [Header],
    data(){
        return {
            username: localStorage.getItem('username')
        }
    },
    methods:{
        logout(){
            localStorage.removeItem('menu')
            localStorage.removeItem('menu1')
            localStorage.removeItem('username')
            localStorage.removeItem('token')
            this.$router.push({path: '/admin/login/'}).catch(() => {});
        }
    }
}
</script>

<style>
.ivu-layout-header{
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.top{
    width: 50%;
}
.user{
    width: 50%;
    color: #fff;
    text-align: right;
}
</style>